﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" href="../assets/css/yui-cssgrids-min.css">
    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
    <link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
    <link rel="shortcut icon" type="image/x-icon" href="../assets/favicon.ico">
    <script src="../../../scripts/yui-source.js"></script>
    <script src="../../../ajax/libs/jquery/2.1.4/jquery.min.js"></script>
    <script src="../../../scripts/classdocs.js"></script>
    <script>
        $(document).ready(function(){
            $.getJSON("../assets/json/easel_class_list.json",function(jd){
                //console.log(jd);
                let node=$("#api-classes");
                node.html("");
                for(let i=0;i<jd.length;i++){
                    node.append("<li><a href=\""+jd[i]+".html\">"+jd[i]+"</a></li>");
                }
                
            });
            apidocs_init();
        });
    </script>
	<title>EaselJS v1.0.0 API Documentation : EventDispatcher</title>
</head>
<body class="yui3-skin-sam">
<div id="doc">
    <div id="hd" class="yui3-g header">
        <div class="yui3-u-3-4">
                <h1><a href="http://createjs.site/easeljs"><img src="../assets/docs-icon-EaselJS.png" title="EaselJS"></a></h1>
        </div>
        <div class="version">
            <em>API Documentation for: 1.0.0</em>
        </div>
    </div>
    <div id="bd" class="yui3-g">
        <div class="yui3-u-1-4">
            <div id="docs-sidebar" class="sidebar apidocs">
                <div id="api-list">
    <h2 class="off-left">APIs</h2>
    <div id="api-tabview" class="tabview">
        <ul class="tabs">
            <li><a href="#api-classes">Classes</a></li>
        </ul>

        <div id="api-tabview-filter">
            <input type="search" id="api-filter" placeholder="Type to filter APIs">
        </div>
        <div id="api-tabview-panel">
            <ul id="api-classes" class="apis classes">
<!-- 从easel_class_list.json读取数据 -->
            </ul>
            <ul id="api-modules" class="apis modules">
            
                <li><a href="../modules/CreateJS.html">CreateJS</a></li>
            
                <li><a href="../modules/EaselJS.html">EaselJS</a></li>
            
            </ul>
        </div>
    </div>
</div>
            </div>
        </div>
        <div class="yui3-u-3-4">
            <div id="api-options">
        Show:
        <label for="api-show-inherited">
            <input type="checkbox" id="api-show-inherited" checked="">
            Inherited
        </label>
        <label for="api-show-protected">
            <input type="checkbox" id="api-show-protected">
            Protected
        </label>
        <label for="api-show-private">
            <input type="checkbox" id="api-show-private">
            Private
        </label>
        <label for="api-show-deprecated">
            <input type="checkbox" id="api-show-deprecated">
            Deprecated
        </label>
    </div>
            <div class="apidocs">
                <div id="docs-main">
                    <div class="content">
                        <h1>EventDispatcher Class</h1>
                        <div class="box meta">
                        <div class="foundat">
                            Defined in: <a href="../files/createjs_events_EventDispatcher.js.html#l41"><code>EventDispatcher:41</code></a>
                        </div>
            Module: <a href="../modules/CreateJS.html">CreateJS</a>
</div>
<div class="box intro">
    <p>EventDispatcher provides methods for managing queues of event listeners and dispatching events.</p>
<p>You can either extend EventDispatcher or mix its methods into an existing prototype or instance by using the
EventDispatcher <a href="EventDispatcher.html#method_initialize" class="crosslink">initialize</a> method.</p>
<p>Together with the CreateJS Event class, EventDispatcher provides an extended event model that is based on the
DOM Level 2 event model, including addEventListener, removeEventListener, and dispatchEvent. It supports
bubbling / capture, preventDefault, stopPropagation, stopImmediatePropagation, and handleEvent.</p>
<p>EventDispatcher also exposes a <a href="EventDispatcher.html#method_on" class="crosslink">on</a> method, which makes it easier
to create scoped listeners, listeners that only run once, and listeners with associated arbitrary data. The 
<a href="EventDispatcher.html#method_off" class="crosslink">off</a> method is merely an alias to
<a href="EventDispatcher.html#method_removeEventListener" class="crosslink">removeEventListener</a>.</p>
<p>Another addition to the DOM Level 2 model is the <a href="EventDispatcher.html#method_removeAllEventListeners" class="crosslink">removeAllEventListeners</a>
method, which can be used to listeners for all events, or listeners for a specific event. The Event object also 
includes a <a href="Event.html#method_remove" class="crosslink">remove</a> method which removes the active listener.</p>
<p><h4>Example</h4>
Add EventDispatcher capabilities to the "MyClass" class.
<pre class="code prettyprint"><code> EventDispatcher.initialize(MyClass.prototype);</code></pre>
<p>Add an event (see <a href="EventDispatcher.html#method_addEventListener" class="crosslink">addEventListener</a>).</p>
<pre class="code prettyprint"><code> instance.addEventListener("eventName", handlerMethod);
 function handlerMethod(event) {
     console.log(event.target + " Was Clicked");
 }</code></pre>
<p><b>Maintaining proper scope</b><br>
Scope (ie. "this") can be be a challenge with events. Using the <a href="EventDispatcher.html#method_on" class="crosslink">on</a>
method to subscribe to events simplifies this.</p>
<pre class="code prettyprint"><code> instance.addEventListener("click", function(event) {
     console.log(instance == this); // false, scope is ambiguous.
 });

 instance.on("click", function(event) {
     console.log(instance == this); // true, "on" uses dispatcher scope by default.
 });</code></pre>
<p>If you want to use addEventListener instead, you may want to use function.bind() or a similar proxy to manage
scope.</p>
<p><b>Browser support</b>
The event model in CreateJS can be used separately from the suite in any project, however the inheritance model
requires modern browsers (IE9+).</p>
</div>
    <div class="constructor">
        <h2>Constructor</h2>
        <div id="method_EventDispatcher" class="method item">
    <h3 class="name"><code>EventDispatcher</code></h3>
        <span class="paren">()</span>
    <div class="meta">
                <p>
                Defined in
        <a href="../files/createjs_events_EventDispatcher.js.html#l41"><code>EventDispatcher:41</code></a>
        </p>
    </div>
    <div class="description">
    </div>
</div>
    </div>
<div id="classdocs" class="tabview">
    <ul class="api-class-tabs">
        <li class="api-class-tab index"><a href="#index">Index</a></li>
            <li class="api-class-tab methods"><a href="#methods">Methods</a></li>
            <li class="api-class-tab properties"><a href="#properties">Properties</a></li>
    </ul>
    <div>
        <div id="index" class="api-class-tabpanel index">
            <h2 class="off-left">Item Index</h2>
                <div class="index-section methods">
                    <h3>Methods</h3>
                    <ul class="index-list methods">
                            <li class="index-item method protected">
                                <a href="#method__dispatchEvent">_dispatchEvent</a>
                            </li>
                            <li class="index-item method">
                                <a href="#method_addEventListener">addEventListener</a>
                            </li>
                            <li class="index-item method">
                                <a href="#method_dispatchEvent">dispatchEvent</a>
                            </li>
                            <li class="index-item method">
                                <a href="#method_hasEventListener">hasEventListener</a>
                            </li>
                            <li class="index-item method">
                                <a href="#method_initialize">initialize</a>
                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_off">off</a>
                            </li>
                            <li class="index-item method">
                                <a href="#method_on">on</a>
                            </li>
                            <li class="index-item method">
                                <a href="#method_removeAllEventListeners">removeAllEventListeners</a>
                            </li>
                            <li class="index-item method">
                                <a href="#method_removeEventListener">removeEventListener</a>
                            </li>
                            <li class="index-item method">
                                <a href="#method_toString">toString</a>
                            </li>
                            <li class="index-item method">
                                <a href="#method_willTrigger">willTrigger</a>
                            </li>
                    </ul>
                </div>
                <div class="index-section properties">
                    <h3>Properties</h3>
                    <ul class="index-list properties">
                            <li class="index-item property protected">
                                <a href="#property__captureListeners">_captureListeners</a>
                            </li>
                            <li class="index-item property protected">
                                <a href="#property__listeners">_listeners</a>
                            </li>
                    </ul>
                </div>
        </div>
<div id="methods" class="api-class-tabpanel">
    <h2 class="off-left">Methods</h2>
    <div id="method__dispatchEvent" class="method item protected">
        <h3 class="name"><code>_dispatchEvent</code></h3>
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>eventObj</code>
                </li>
                <li class="arg">
                        <code>eventPhase</code>
                </li>
            </ul><span class="paren">)</span>
        </div>
        <span class="flag protected">protected</span>
        <div class="meta">
            <p>Defined in<a href="../files/createjs_events_EventDispatcher.js.html#l380"><code>_dispatchEvent:380</code></a></p>
        </div>
        <div class="description"></div>
        <div class="params">
            <h4>Parameters:</h4>
            <ul class="params-list">
                <li class="param">
                        <code class="param-name">eventObj</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a> | <a href="Event.html" class="crosslink">Event</a></span>
                    <div class="param-description">
                    </div>
                </li>
                <li class="param">
                        <code class="param-name">eventPhase</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>
                    <div class="param-description">
                    </div>
                </li>
            </ul>
        </div>
    </div>
    <div id="method_addEventListener" class="method item">
        <h3 class="name"><code>addEventListener</code></h3>
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>type</code>
                </li>
                <li class="arg">
                        <code>listener</code>
                </li>
                <li class="arg">
                        <code class="optional">[useCapture]</code>
                </li>
            </ul><span class="paren">)</span>
        </div>
        <span class="returns-inline">
            <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function" class="crosslink external" target="_blank">Function</a> | <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>
        </span>
        <div class="meta">
                <p>
                Defined in
            <a href="../files/createjs_events_EventDispatcher.js.html#l140"><code>addEventListener:140</code></a>
            </p>
        </div>
        <div class="description">
            <p>Adds the specified event listener. Note that adding multiple listeners to the same function will result in
multiple callbacks getting fired.</p>
            <h4>Example</h4>
            <pre class="code prettyprint"><code> displayObject.addEventListener("click", handleClick);
 function handleClick(event) {
    // Click happened.
 }</code></pre>
        </div>
        <div class="params">
            <h4>Parameters:</h4>
            <ul class="params-list">
                <li class="param">
                        <code class="param-name">type</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
                    <div class="param-description">
                        <p>The string type of the event.</p>
                    </div>
                </li>
                <li class="param">
                        <code class="param-name">listener</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function" class="crosslink external" target="_blank">Function</a> | <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>
                    <div class="param-description">
                        <p>An object with a handleEvent method, or a function that will be called when
the event is dispatched.</p>
                    </div>
                </li>
                <li class="param">
                        <code class="param-name optional">[useCapture]</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>
                    <div class="param-description">
                        <p>For events that bubble, indicates whether to listen for the event in the capture or bubbling/target phase.</p>
                    </div>
                </li>
            </ul>
        </div>
        <div class="returns">
            <h4>Returns:</h4>
            <div class="returns-description">
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function" class="crosslink external" target="_blank">Function</a> | <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>:
                    <p>Returns the listener for chaining or assignment.</p>
            </div>
        </div>
</div>
    <div id="method_dispatchEvent" class="method item">
        <h3 class="name"><code>dispatchEvent</code></h3>
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>eventObj</code>
                </li>
                <li class="arg">
                        <code class="optional">[bubbles]</code>
                </li>
                <li class="arg">
                        <code class="optional">[cancelable]</code>
                </li>
            </ul><span class="paren">)</span>
        </div>
        <span class="returns-inline">
            <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
        </span>
        <div class="meta">
            <p>
                Defined in
            <a href="../files/createjs_events_EventDispatcher.js.html#l285"><code>dispatchEvent:285</code></a>
            </p>
        </div>
        <div class="description">
            <p>Dispatches the specified event to all listeners.</p>
            <h4>Example</h4>
            <pre class="code prettyprint"><code> // Use a string event
 this.dispatchEvent("complete");

 // Use an Event instance
 var event = new createjs.Event("progress");
 this.dispatchEvent(event);</code></pre>
        </div>
        <div class="params">
            <h4>Parameters:</h4>
            <ul class="params-list">
                <li class="param">
                        <code class="param-name">eventObj</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a> | <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a> | <a href="Event.html" class="crosslink">Event</a></span>
                    <div class="param-description">
                        <p>An object with a "type" property, or a string type.
While a generic object will work, it is recommended to use a CreateJS Event instance. If a string is used,
dispatchEvent will construct an Event instance if necessary with the specified type. This latter approach can
be used to avoid event object instantiation for non-bubbling events that may not have any listeners.</p>
                    </div>
                </li>
                <li class="param">
                        <code class="param-name optional">[bubbles]</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>
                    <div class="param-description">
                        <p>Specifies the <code>bubbles</code> value when a string was passed to eventObj.</p>
                    </div>
                </li>
                <li class="param">
                        <code class="param-name optional">[cancelable]</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>
                    <div class="param-description">
                        <p>Specifies the <code>cancelable</code> value when a string was passed to eventObj.</p>
                    </div>
                </li>
            </ul>
        </div>
        <div class="returns">
            <h4>Returns:</h4>
            <div class="returns-description">
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>:
                    <p>Returns false if <code>preventDefault()</code> was called on a cancelable event, true otherwise.</p>
            </div>
        </div>
</div>
                    <div id="method_hasEventListener" class="method item">
    <h3 class="name"><code>hasEventListener</code></h3>
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>type</code>
                </li>
            </ul><span class="paren">)</span>
        </div>
        <span class="returns-inline">
            <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
        </span>
    <div class="meta">
                <p>
                Defined in
        <a href="../files/createjs_events_EventDispatcher.js.html#l339"><code>hasEventListener:339</code></a>
        </p>
    </div>
    <div class="description">
        <p>Indicates whether there is at least one listener for the specified event type.</p>
    </div>
        <div class="params">
            <h4>Parameters:</h4>
            <ul class="params-list">
                <li class="param">
                        <code class="param-name">type</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
                    
                    <div class="param-description">
                        <p>The string type of the event.</p>
                    </div>
                </li>
            </ul>
        </div>
        <div class="returns">
            <h4>Returns:</h4>
            <div class="returns-description">
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>:
                    <p>Returns true if there is at least one listener for the specified event.</p>
            </div>
        </div>
</div>
                    <div id="method_initialize" class="method item">
    <h3 class="name"><code>initialize</code></h3>
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>target</code>
                </li>
            </ul><span class="paren">)</span>
        </div>
        <span class="flag static">static</span>
    <div class="meta">
                <p>
                Defined in
        <a href="../files/createjs_events_EventDispatcher.js.html#l116"><code>initialize:116</code></a>
        </p>
    </div>
    <div class="description">
        <p>Static initializer to mix EventDispatcher methods into a target object or prototype.</p>
<pre class="code prettyprint"><code>    EventDispatcher.initialize(MyClass.prototype); // add to the prototype of the class
    EventDispatcher.initialize(myObject); // add to a specific instance</code></pre>
    </div>
        <div class="params">
            <h4>Parameters:</h4>
            <ul class="params-list">
                <li class="param">
                        <code class="param-name">target</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>
                    <div class="param-description">
                        <p>The target object to inject EventDispatcher methods into. This can be an instance or a
prototype.</p>
                    </div>
                </li>
            </ul>
        </div>
</div>
                    <div id="method_off" class="method item">
    <h3 class="name"><code>off</code></h3>
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>type</code>
                </li>
                <li class="arg">
                        <code>listener</code>
                </li>
                <li class="arg">
                        <code class="optional">[useCapture]</code>
                </li>
            </ul><span class="paren">)</span>
        </div>
    <div class="meta">
                <p>
                Defined in
        <a href="../files/createjs_events_EventDispatcher.js.html#l249"><code>off:249</code></a>
        </p>
    </div>
    <div class="description">
        <p>A shortcut to the removeEventListener method, with the same parameters and return value. This is a companion to the
.on method.</p>
<p><b>IMPORTANT:</b> To remove a listener added with <code>on</code>, you must pass in the returned wrapper function as the listener. See 
<a href="EventDispatcher.html#method_on" class="crosslink">on</a> for an example.</p>
    </div>
        <div class="params">
            <h4>Parameters:</h4>
            <ul class="params-list">
                <li class="param">
                        <code class="param-name">type</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
                    <div class="param-description">
                        <p>The string type of the event.</p>
                    </div>
                </li>
                <li class="param">
                        <code class="param-name">listener</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function" class="crosslink external" target="_blank">Function</a> | <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>
                    <div class="param-description">
                        <p>The listener function or object.</p>
                    </div>
                </li>
                <li class="param">
                        <code class="param-name optional">[useCapture]</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>
                    <div class="param-description">
                        <p>For events that bubble, indicates whether to listen for the event in the capture or bubbling/target phase.</p>
                    </div>
                </li>
            </ul>
        </div>
</div>
                    <div id="method_on" class="method item">
    <h3 class="name"><code>on</code></h3>
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>type</code>
                </li>
                <li class="arg">
                        <code>listener</code>
                </li>
                <li class="arg">
                        <code class="optional">[scope]</code>
                </li>
                <li class="arg">
                        <code class="optional">[once=false]</code>
                </li>
                <li class="arg">
                        <code class="optional">[data]</code>
                </li>
                <li class="arg">
                        <code class="optional">[useCapture=false]</code>
                </li>
            </ul><span class="paren">)</span>
        </div>
        <span class="returns-inline">
            <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function" class="crosslink external" target="_blank">Function</a></span>
        </span>
    <div class="meta">
                <p>
                Defined in
        <a href="../files/createjs_events_EventDispatcher.js.html#l173"><code>on:173</code></a>
        </p>
    </div>
    <div class="description">
        <p>A shortcut method for using addEventListener that makes it easier to specify an execution scope, have a listener
only run once, associate arbitrary data with the listener, and remove the listener.</p>
        <p>This method works by creating an anonymous wrapper function and subscribing it with addEventListener.
The wrapper function is returned for use with <code>removeEventListener</code> (or <code>off</code>).</p>
        <p><b>IMPORTANT:</b> To remove a listener added with <code>on</code>, you must pass in the returned wrapper function as the listener, or use
<a href="Event.html#method_remove" class="crosslink">remove</a>. Likewise, each time you call <code>on</code> a NEW wrapper function is subscribed, so multiple calls
to <code>on</code> with the same params will create multiple listeners.</p>
<h4>Example</h4>
<pre class="code prettyprint"><code>    var listener = myBtn.on("click", handleClick, null, false, {count:3});
    function handleClick(evt, data) {
        data.count -= 1;
        console.log(this == myBtn); // true - scope defaults to the dispatcher
        if (data.count == 0) {
            alert("clicked 3 times!");
            myBtn.off("click", listener);
            // alternately: evt.remove();
        }
    }</code></pre>
    </div>
        <div class="params">
            <h4>Parameters:</h4>
            <ul class="params-list">
                <li class="param">
                        <code class="param-name">type</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
                    <div class="param-description">
                        <p>The string type of the event.</p>
                    </div>
                </li>
                <li class="param">
                        <code class="param-name">listener</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function" class="crosslink external" target="_blank">Function</a> | <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>
                    <div class="param-description">
                        <p>An object with a handleEvent method, or a function that will be called when
the event is dispatched.</p>
                    </div>
                </li>
                <li class="param">
                        <code class="param-name optional">[scope]</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>
                    <div class="param-description">
                        <p>The scope to execute the listener in. Defaults to the dispatcher/currentTarget for function listeners, and to the listener itself for object listeners (ie. using handleEvent).</p>
                    </div>
                </li>
                <li class="param">
                        <code class="param-name optional">[once=false]</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>
                    <div class="param-description">
                        <p>If true, the listener will remove itself after the first time it is triggered.</p>
                    </div>
                </li>
                <li class="param">
                        <code class="param-name optional">[data]</code>
                        <span class="type"></span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>
                    <div class="param-description">
                        <p>Arbitrary data that will be included as the second parameter when the listener is called.</p>
                    </div>
                </li>
                <li class="param">
                        <code class="param-name optional">[useCapture=false]</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>
                    <div class="param-description">
                        <p>For events that bubble, indicates whether to listen for the event in the capture or bubbling/target phase.</p>
                    </div>
                </li>
            </ul>
        </div>
        <div class="returns">
            <h4>Returns:</h4>
            <div class="returns-description">
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function" class="crosslink external" target="_blank">Function</a></span>:
                    <p>Returns the anonymous function that was created and assigned as the listener. This is needed to remove the listener later using .removeEventListener.</p>
            </div>
        </div>
</div>
                    <div id="method_removeAllEventListeners" class="method item">
    <h3 class="name"><code>removeAllEventListeners</code></h3>
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code class="optional">[type]</code>
                </li>
            </ul><span class="paren">)</span>
        </div>
    <div class="meta">
                <p>
                Defined in
        <a href="../files/createjs_events_EventDispatcher.js.html#l263"><code>removeAllEventListeners:263</code></a>
        </p>
    </div>
    <div class="description">
        <p>Removes all listeners for the specified type, or all listeners of all types.</p>
<h4>Example</h4>

<pre class="code prettyprint"><code> // Remove all listeners
 displayObject.removeAllEventListeners();

 // Remove all click listeners
 displayObject.removeAllEventListeners("click");</code></pre>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name optional">[type]</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>
                    

                    

                    <div class="param-description">
                        <p>The string type of the event. If omitted, all listeners for all types will be removed.</p>

                    </div>

                    
                </li>
            
            </ul>
        </div>
    

    

    
</div>

                
                    <div id="method_removeEventListener" class="method item">
    <h3 class="name"><code>removeEventListener</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code>type</code>
                    
                </li>
            
                <li class="arg">
                    
                        <code>listener</code>
                    
                </li>
            
                <li class="arg">
                    
                        <code class="optional">[useCapture]</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/createjs_events_EventDispatcher.js.html#l219"><code>removeEventListener:219</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>Removes the specified event listener.</p>
<p><b>Important Note:</b> that you must pass the exact function reference used when the event was added. If a proxy
function, or function closure is used as the callback, the proxy/closure reference must be used - a new proxy or
closure will not work.</p>
<h4>Example</h4>

<pre class="code prettyprint"><code> displayObject.removeEventListener("click", handleClick);</code></pre>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name">type</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
                    

                    

                    <div class="param-description">
                        <p>The string type of the event.</p>

                    </div>

                    
                </li>
            
                <li class="param">
                    
                        <code class="param-name">listener</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function" class="crosslink external" target="_blank">Function</a> | <a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>
                    

                    

                    <div class="param-description">
                        <p>The listener function or object.</p>

                    </div>

                    
                </li>
            
                <li class="param">
                    
                        <code class="param-name optional">[useCapture]</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
                        <span class="flag optional" title="This parameter is optional.">optional</span>
                    

                    

                    <div class="param-description">
                        <p>For events that bubble, indicates whether to listen for the event in the capture or bubbling/target phase.</p>

                    </div>

                    
                </li>
            
            </ul>
        </div>
    

    

    
</div>

                
                    <div id="method_toString" class="method item">
    <h3 class="name"><code>toString</code></h3>

    
        <span class="paren">()</span>
    

    
        <span class="returns-inline">
            <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
        </span>
    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/createjs_events_EventDispatcher.js.html#l370"><code>toString:370</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        
    </div>

    

    
        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                
                    
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>:
                    
                    <p>a string representation of the instance.</p>

                
            </div>
        </div>
    

    
</div>

                
                    <div id="method_willTrigger" class="method item">
    <h3 class="name"><code>willTrigger</code></h3>

    
        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
            
                <li class="arg">
                    
                        <code>type</code>
                    
                </li>
            
            </ul><span class="paren">)</span>
        </div>
    

    
        <span class="returns-inline">
            <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>
        </span>
    

    

    

    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/createjs_events_EventDispatcher.js.html#l350"><code>willTrigger:350</code></a>
        
        </p>


        

        
    </div>

    <div class="description">
        <p>Indicates whether there is at least one listener for the specified event type on this object or any of its
ancestors (parent, parent&#39;s parent, etc). A return value of true indicates that if a bubbling event of the
specified type is dispatched from this object, it will trigger at least one listener.</p>
<p>This is similar to <a href="EventDispatcher.html#method_hasEventListener" class="crosslink">hasEventListener</a>, but it searches the entire
event flow for a listener, not just this object.</p>

    </div>

    
        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
            
                <li class="param">
                    
                        <code class="param-name">type</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
                    

                    

                    <div class="param-description">
                        <p>The string type of the event.</p>

                    </div>

                    
                </li>
            
            </ul>
        </div>
    

    
        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                
                    
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>:
                    
                    <p>Returns <code>true</code> if there is at least one listener for the specified event.</p>

                
            </div>
        </div>
    

    
</div>

                
            </div>
        

        
            <div id="properties" class="api-class-tabpanel">
                <h2 class="off-left">Properties</h2>

                
                    <div id="property__captureListeners" class="property item protected">
    <h3 class="name"><code>_captureListeners</code></h3>
    <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>

    

    
        <span class="flag protected">protected</span>
    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/createjs_events_EventDispatcher.js.html#l106"><code>_captureListeners:106</code></a>
        
        </p>

        

        
    </div>

    <div class="description">
        
    </div>

    

    

    
</div>

                
                    <div id="property__listeners" class="property item protected">
    <h3 class="name"><code>_listeners</code></h3>
    <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>

    

    
        <span class="flag protected">protected</span>
    

    

    

    

    <div class="meta">
        
            
                
                <p>
                
                Defined in
                
            
        
        
        <a href="../files/createjs_events_EventDispatcher.js.html#l99"><code>_listeners:99</code></a>
        
        </p>

        

        
    </div>

    <div class="description">
        
    </div>

    

    

    
</div>

                
            </div>
        

        

        
    </div>
</div>

                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="../assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="../assets/js/yui-prettify.js"></script>
<script src="../api.js"></script>
<script src="../assets/js/api-filter.js"></script>
<script src="../assets/js/api-list.js"></script>
<script src="../assets/js/api-search.js"></script>
<script src="../assets/js/apidocs.js"></script>
</body>
</html>
